﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ARS.Control.Custom.Calendar.Widget
{
    [DefaultProperty("Text")]
    [ToolboxData("<{0}:Calendar runat=server></{0}:Calendar>")]
    public class Calendar:Literal
    {
        public override void RenderControl(System.Web.UI.HtmlTextWriter writer)
        {
            if (this.Date == null)
            {
                this.Date = DateTime.Now.ToShortDateString();
            }
            writer.Write(Resource.Res_Calendar.wnl);
            writer.Write(ARS.PublicTool.WebHelper.WebPage.ScriptHelper.GetScriptStr(string.Format("var ARS_Calendar_{1}=new ARS_Calendar('{0}',{{ color1: '{2}', color2: '{3}', nowBorder: '1px solid #a5b9da', nowBackground: '#c1d9ff' }});", this.Date, this.ID,this.Color1,this.Color2)));
            base.RenderControl(writer);
        }

        /// <summary>
        /// 当前日期
        /// </summary>
        public string Date
        {
            get;
            set;
        }

        private string _color1 = "#c60b02";
        public string Color1
        {
            get
            {
                return this._color1;
            }
            set
            {
                this._color1 = value;
            }
        }

        private string _color2 = "#313131";
        public string Color2
        {
            get
            {
                return this._color2;
            }
            set
            {
                this._color2 = value;
            }
        }
    }
}
